package org.springblade.modules.mes.base.utils;

import java.util.List;

public class StringUtils {
	public static boolean isEmpty(String v) {
		if (v == null || v.length() == 0) {
			return true;
		}
		return false;
	}
	public static boolean isNotEmpty(String v) {
		return !isEmpty(v);
	}

	public static boolean isNotBlank(String v) {
		return !isEmpty(v);
	}
	public static String right(String v,int idx) {
		 if(v.length() > 0 || (v.length()-1)<idx){
		 	return "";
		 }
		return v.substring(0,v.length() - idx);
	}

	public static String join(String ...vs){
		StringBuffer r = new StringBuffer();
		if(vs != null){
			for (String v : vs) {
				r.append(v);

			}
		}
		return r.toString();
	}

	public static String join(List<String> list, String ...vs){
		StringBuffer r = new StringBuffer();
		if(list !=null){
			list.forEach(s->{
				r.append(s);
			});
		}
		if(vs != null){
			for (String v : vs) {
				r.append(v);

			}
		}
		return r.toString();
	}

	public static String trim(String v){
		if(v == null){
			return "";
		}
		return v.trim();
	}

}
